package cn.bbdx.qsh.baking.service.impl;

import cn.bbdx.qsh.baking.mapper.ContentMapper;
import cn.bbdx.qsh.baking.pojo.entity.Content;
import cn.bbdx.qsh.baking.pojo.vo.*;
import cn.bbdx.qsh.baking.service.ContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ContentServiceImpl implements ContentService {
    @Autowired
    ContentMapper mapper;

    @Override
    public int insert(Content content) {
        return mapper.insert(content);
    }

    @Override
    public List<ContentManagementVO> selectByType(Integer type, Long id) {
        return mapper.selectByType(type, id);
    }

    @Override
    public int update(Content content) {
        return mapper.update(content);
    }

    @Override
    public ContentUpdateVO selectByIdForUpdate(Long id) {
        return mapper.selectByIdForUpdate(id);
    }

    @Override
    public int deleteById(Long id) {
        return mapper.deleteById(id);
    }

    @Override
    public List<ContentIndexVO> selectByTypeAndCategoryId(Integer type, Long categoryId) {
        return mapper.selectByTypeAndCategoryId(type, categoryId);
    }

    @Override
    public ContentDetailVO selectByIdForDetail(Long id) {
        return mapper.selectByIdForDetail(id);
    }

    @Override
    public List<ContentSimpleVO> selectByUserId(Long userId) {
        return mapper.selectByUserId(userId);
    }

    @Override
    public int updateViewCountById(Long id) {
        return mapper.updateViewCountById(id);
    }

    @Override
    public List<ContentSimpleVO> selectHot() {
        return mapper.selectHot();
    }

    @Override
    public List<ContentIndexVO> selectListByType(Integer type) {
        return mapper.selectListByType(type);
    }

    @Override
    public List<ContentIndexVO> selectByWd(String wd) {
        return mapper.selectByWd(wd);
    }

    @Override
    public int updateCommentCountById(Long contentId) {
        return mapper.updateCommentCountById(contentId);
    }

    @Override
    public List<ContentAdminVO> selectByTypeForAdmin(Integer type) {
        return mapper.selectByTypeForAdmin(type);
    }
}
